﻿Imports System.Configuration


Partial Friend Class MyApplication
    Dim g_oGestorBitacora As New BLL.GestorBitacora()

    'Dim frm As New LoginForm


    'Protected Overrides Function OnStartup(ByVal eventArgs As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) As Boolean

    '    Dim Splash As New Intro()
    '    Splash.Name = "TicketYa"
    '    Splash.Show()

    '    Dim auth As Boolean = False
    '    Do Until auth = True
    '        auth = formLogin()
    '    Loop

    '    Splash.Close()

    '    Return MyBase.OnStartup(eventArgs)
    'End Function

    'Private Function formLogin() As Boolean
    '    Dim ret As Boolean = False

    '    If frm.ShowDialog = DialogResult.OK Then
    '        Try
    '            BLL.Actual.usuario = BLL.SeguridadBLL.doLogin(frm.UserTextBox.Text, frm.PassTextBox.Text)
    '            ret = True
    '            Try
    '                BLL.BitacoraBLL.setBitacora(BLL.Actual.usuario, frm.UserTextBox.Text, Utilitarios.Enumeradores.Bitacora.LogueoExitoso)
    '            Catch excep As Excepciones.InsertExcepcion
    '                Application.manejarExcepcion(excep)
    '            End Try
    '        Catch ex As Excepciones.UsuarioNoEncontradoExcepcion
    '            Try
    '                BLL.BitacoraBLL.setBitacora(Nothing, frm.UserTextBox.Text + "," + frm.PassTextBox.Text, Utilitarios.Enumeradores.Bitacora.LogueoFallido)
    '            Catch excep As Excepciones.InsertExcepcion
    '                Application.manejarExcepcion(excep)
    '            End Try
    '            Application.manejarExcepcion(ex)
    '        Catch ex As Excepciones.IdiomaNoEncontradoExcepcion
    '            Application.manejarExcepcion(ex)
    '            ret = True
    '        Catch ex As Excepciones.PermisoNoEncontradoExcepcion
    '            Application.manejarExcepcion(ex)
    '            ret = True
    '        Catch ex As Excepciones.FamiliaNoEncontradaExcepcion
    '            Application.manejarExcepcion(ex)
    '            ret = True
    '        Catch ex As Excepciones.ConexionImposibleExcepcion
    '            Application.manejarExcepcion(ex)
    '        Catch ex As Exception
    '            Application.manejarExcepcion(ex)
    '        End Try
    '    Else
    '        Environment.Exit(1)
    '    End If
    '    Return ret
    'End Function

    Public Shared Sub ManejarExcepcion(ByVal ex As Exception)
        If (TypeOf ex Is Excepciones.ExceptionManager) Then
            Dim excep = DirectCast(ex, Excepciones.ExceptionManager)
            Try
                MsgBox(excep.mensaje, excep.tipo)
            Catch e As Excepciones.ExcepcionNoEncontradaExcepcion
                MyApplication.ManejarExcepcion(e)
            End Try
        End If
    End Sub

End Class
